<?php

require 'db.php';

$major=0;

$strsql0 = "select * from major";
$result0 = mysqli_query($link, $strsql0);
$data_major = mysqli_fetch_all($result0);

$strsql = "select * from student left join major on student.major = major.Id";

if(isset($_GET['major'])){
    $major = $_GET['major'];
    $strsql .=" where major = '".$major."'";
}

echo $strsql;
echo "<br>";

$result = mysqli_query($link, $strsql);
$data = mysqli_fetch_all($result);

mysqli_free_result($result);
mysqli_close($link);


require 'shaixuan.html';
require 'showdata.html';
?>